/***********************************************************************************
 *              Copyright 2006 - 2050, Hisilicon Tech. Co., Ltd.
 *                           ALL RIGHTS RESERVED
 * FileName: mapi_debug.h
 * Description: Hi3110QV100 DVN MAPI layer debug config file.
 *
 * History:
 * Version   Date           Author    DefectNum    Description
 *  V1.0      2007/11/27    y45343                 create file
 ***********************************************************************************/
#ifndef __MAPI_DEBUG_H__
#define __MAPI_DEBUG_H__

#ifdef __cplusplus
    #if __cplusplus
    extern "C"{
    #endif  /* __cplusplus */
#endif  /* __cplusplus */

#define MAPI_DETAIL FALSE
#define MAPI_DEBUG FALSE
#define MAPI_ERROR TRUE

#if (MAPI_ERROR==TRUE)
    #define m_errorTrace TDRV_PRINTF
#else
    #define m_errorTrace
#endif

#if (MAPI_DEBUG==TRUE)
    #define m_debugTrace TDRV_PRINTF
#else
    #define m_debugTrace
#endif

#if (MAPI_DETAIL==TRUE)
    #define m_detailTrace TDRV_PRINTF
#else
    #define m_detailTrace
#endif

#define STB8_DRIVER_VERSION_NAME "0.0.0.0"
#define STB8_DRIVER_DETAIL_NAME  "Hisi MAPI V0.0.0.0 20080521"

/*
 *  || debug info for hisilicon mapi layer  ||
 */
typedef enum hiMAPI_ERRLEVEL_E
{
    MAPI_TRACE_DEBUG = 1,  /* debug-level                       */
    MAPI_TRACE_WARNING,    /* warning information               */
    MAPI_TRACE_ERROR,      /* error conditions                  */
} MAPI_ERRLEVEL_E;

#define HI_MAPI_DEBUG
#define HI_MAPI_TRACE_LEVEL MAPI_TRACE_DEBUG

#ifdef HI_MAPI_DEBUG
#define hi_mapi_trace( level, fmt, args... )\
    do { \
        if(level >= HI_MAPI_TRACE_LEVEL)\
        {\
            TDRV_PRINTF("[MAPI]%04d@%s(): ", __LINE__, __FUNCTION__);\
            TDRV_PRINTF( fmt, ##args );\
        }\
    } while (0)

#define	gotohere \
		do {  \
			TDRV_PRINTF("[GDB][%04d]@[%s()]\n", __LINE__, __FUNCTION__);\
		     } while (0)
#else
#define hi_mapi_trace( level, fmt, args... )
#define gotohere
#endif

#define MAPI_ASSERT(expr)  do {      \
    if(!(expr)) { \
        TDRV_PRINTF( "Assertion [%s] failed! %s:%s(line=%d)\n",\
#expr,__FILE__,__FUNCTION__,__LINE__); \
        _exit(0);     \
    } } while(0)

#ifdef __cplusplus
    #if __cplusplus
    }
    #endif  /* __cplusplus */
#endif  /* __cplusplus */

#endif /* __MAPI_DEBUG_H__ */
